package com.yunji.cabinet.enums;

import com.yunji.common.utils.bean.BeanUtils;

public enum UpgradeTaskTypeEnum {
    BATCH(0, "批量"),
    APPOINT(1, "指定");
    private final Integer code;
    private final String text;

    UpgradeTaskTypeEnum(Integer code, String text) {
        this.code = code;
        this.text = text;
    }

    public Integer getCode() {
        return code;
    }

    public String getText() {
        return text;
    }

    public static String get(String code) {
        if (BeanUtils.isNull(code)) {
            return null;
        }
        UpgradeTaskTypeEnum[] enums = UpgradeTaskTypeEnum.values();
        for (UpgradeTaskTypeEnum e : enums) {
            if (e.code.equals(code)) {
                return e.text;
            }
        }
        return null;
    }
}
